package com.example.tsproject.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.tsproject.entity.Teachers;
import com.example.tsproject.mapper.StudentsMapper;
import com.example.tsproject.service.TeachersService;
import com.example.tsproject.mapper.TeachersMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Optional;

/**
* @author DELL
* @description 针对表【teachers】的数据库操作Service实现
* @createDate 2024-09-24 21:09:14
*/
@Service
public class TeachersServiceImpl extends ServiceImpl<TeachersMapper, Teachers>
    implements TeachersService{

    @Autowired
    private TeachersMapper teachersMapper;

    @Override
    public Teachers findByEmail(String email) {
        QueryWrapper<Teachers> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("email", email+"@qq.com");
        return baseMapper.selectOne(queryWrapper);
    }
    public Teachers findByEmployeeNumber(String employeeNumber) {
        // 假设 `employee_number` 是 `Teachers` 表的字段
        QueryWrapper<Teachers> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("employee_number", employeeNumber);
        return this.getOne(queryWrapper);
    }

    @Override
    public Optional<Teachers> findTeachersJudge(String employee_number, String password) {
        return teachersMapper.findTeachersJudge(employee_number,password);
    }

    @Override
    public Teachers findTeachers(String employee_number) {
        return teachersMapper.findTeachers(employee_number);
    }
}




